package cn.gjxblog.aop.autoproxy.demo3;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * 切面
 *
 *
 */

@Aspect
@Component
public class UserAspect {

    @Pointcut("execution(* cn.gjxblog.aop.autoproxy.demo3.*.*(..))")
    public void point(){

    }

    @Before("point()")
    public void before(){
        System.out.println("method invoke Before......");
    }

    @After("point()")
    public void After(){
        System.out.println("method invoke After.......");
    }

    @AfterReturning("point()")
    public void AfterReturning(){
        System.out.println("method invoke AfterReturning.......");
    }


    @AfterThrowing("point()")
    public void AfterThrowing(){
        System.out.println("method invoke AfterThrowing.......");
    }

    // 此处需要注意：若写了@Around方法，那么最后只会执行@Around和@AfterReturning 其它的都不会执行
//    @Around("point()")
    public void Around(){
        System.out.println("method invoke Around.......");
    }
}
